home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 129_01 / 210ctdl.h < prev    next >
Text File  |  1985-03-09  |  15KB  |  434 lines

  1. /*                Ctdl210.h                */
  2. /*    #include file for all Citadel C files.                */
  3.  
  4. /*                #defines        82Dec10 dvm    */
  5. /*                                    */
  6. /* #defs supported in current system:                    */
  7. /*                                    */
  8. /* #def FDC-1 for the TeleTek (dvm code)                */
  9. /* #def VFC-2 for the Big Board (dvm code)                */
  10. /*                                    */
  11. /* #def TEST for special small-scale test version            */
  12.  
  13.  
  14. char firstExtern;    /* this should ALWAYS be the first declaration    */
  15.  
  16. char mData;            /* Modem data port            */
  17.  
  18. char megaHz;            /* Z80 clock rate (for wait loops)    */
  19. unsigned secondsfactor;     /* 8085 needs different from 8080/Z80    */
  20.  
  21. char *nodeName;
  22. char *nodeTitle;
  23. char *nodeId;
  24.  
  25. int  cryptSeed;
  26. char rcpm;            /* TRUE to run in RCP/M mode        */
  27. char clock;            /* TRUE  if we have a hardware clock    */
  28.  
  29. char homeDisk, homeUser, msgDisk;    /* where we keep our data files */
  30. char ourDisk, ourUser;            /* where we are just now    */
  31.  
  32. char unlogEnterOk;        /* TRUE if OK to enter messages anon    */
  33. char unlogReadOk;        /* TRUE if unlogged folks can read mess */
  34. char unlogLoginOk;        /* TRUE if spontan. new accounts ok.    */
  35. char nonAideRoomOk;        /* TRUE general folks can make rooms    */
  36. char noMail;            /* TRUE if mail is not allowed        */
  37.  
  38. /* Citadel programs use readSysTab() and writeSysTab() to write an    */
  39. /* image of the external variables in RAM to disk, and later restore    */
  40. /* it.    The image is stored in ctdlTabl.sys .  If ctdlTabl.sys is lost, */
  41. /* sysop.com will automatically reconstruct the hard way when invoked,    */
  42. /* and write a new ctdlTabl.sys out when finished.  CtdlTabl.sys is    */
  43. /* always destroyed after reading, to minimize the possibility of    */
  44. /* reading an out-of-date version.  In general, the technique works    */
  45. /* well and saves time and head-banging on bootup.  You should,     */
  46. /* however, note carefully the following cautions:            */
  47. /*  o  "char firstExtern;" should >always< be the first         */
  48. /*     declaration in citadel.h                     */
  49. /*  o  "char lastExtern;"  should >always< be the last            */
  50. /*     declaration in citadel.h                     */
  51. /*  o  Whenever you change the declarations in 210Ctdl.h you should:    */
  52. /*   -->  destroy the current ctdlTabl.sys file             */
  53. /*   -->  recompile and reload all citadel programs which access    */
  54. /*      ctdlTabl.sys -- currently citadel.com & configur.com        */
  55. /*   -->  use configur.com to build a new ctdlTabl.sys file        */
  56. /*                                    */
  57. /* If you ignore these warnings, little pixies will prick you in your    */
  58. /* sleep for the rest of your life.                    */
  59.  
  60. /*    stuff to distinguish the various Citadel programs        */
  61. #define CITADEL     0    /* prinipal program            */
  62. #define xxxxx        1    /* unused                */
  63. #define NET        2    /* network downloader    (future)    */
  64. #define ARCHIVE     3    /* backup program    (future)    */
  65. #define CONFIGURE    4    /* configuration program        */
  66. char    weAre;            /* set first thing by main()        */
  67.  
  68. /*            Stuff to size system with:            */
  69. /* WARNING!!! if you expand MAXROOMS beyond 128, horrible, horrible    */
  70. /* things will happen to the userlog entries, which will no longer    */
  71. /* fit in the assigned 256-byte records and will overwrite things    */
  72. /* with normally undesirable results. 82Nov10CrT            */
  73. #ifdef TEST
  74. #define MAXROOMS    6
  75. #define MAXLOGTAB    4
  76. #else
  77.  
  78. #define MAXROOMS       64    /* number of rooms allowed in system    */
  79.  
  80. #define MAXLOGTAB     180    /* number of log entries supported    */
  81.  
  82. #endif
  83.  
  84. #define SECSPERROOM    2    /* sectors/room             */
  85. #define ROOMSECTORS   (MAXROOMS*SECSPERROOM)
  86. #define SECSPERLOG    3    /* three sectors per log record     */
  87. #define LOGSECTORS    (MAXLOGTAB*SECSPERLOG)
  88.  
  89. /*        Stuff nowadays usually in bdscio.h:            */
  90. /* values for functions to return: */
  91. #define TRUE        1
  92. #define FALSE        0
  93. #define ERROR           -1
  94.  
  95. #define SAMESTRING    0    /* value for strcmp() & friend        */
  96.  
  97. /* ASCII characters: */
  98. #define NULL        0
  99. #define SOH        1
  100. #define CNTRLC        3
  101. #define EOT        4
  102. #define ACK        6
  103. #define BELL        7
  104. #define BACKSPACE    8
  105. #define CNTRLI        9    /* aka tab                */
  106. #define TAB        9    /* aka ^I                */
  107. #define NEWLINE        10    /* "linefeed" to philistines.        */
  108. #define CNTRLO           15
  109. #define CNTRLp           16
  110. #define XOFF           19    /* control-s                */
  111. #define NAK           21
  112. #define CAN           24
  113. #define CNTRLZ           26
  114. #define CPMEOF       CNTRLZ
  115. #define ESC           27    /* altmode                */
  116. #define DEL         0x7F    /* delete char                */
  117.  
  118. /* for packing & unpacking ints: */
  119. #define BYTE          256
  120.  
  121. /*            Stuff for rooms:                */
  122. #define LOBBY        0    /* Lobby> is >always< room 0.        */
  123. #define MAILROOM    1    /* Mail>  is >always< room 1.        */
  124. #define AIDEROOM    2    /* Aide> is >always< room 2.        */
  125.  
  126. #define NAMESIZE       20    /* length of room names         */
  127.  
  128. #ifdef TEST
  129. #define MSGSPERRM      58    /* should be >= MAILSLOTS        */
  130. #else
  131. #define MSGSPERRM      58    /* roombuf must be 256 bytes or less.    */
  132. #endif
  133.  
  134. #define FILSPERRM      10    /* roombuf must be 256 bytes or less.    */
  135. #define SECTSIZE      128
  136. char debug;            /* turns debug printout on and off    */
  137. int  roomfl;            /* file descriptor for ctdlRoom.sys    */
  138.  
  139. #define UNREAD        0    /* Only list unread rooms        */
  140. #define ALMOST_ALL    1    /* List both unread and read rooms    */
  141. #define FORGOT        2    /* List forgotten public rooms        */
  142.  
  143. #define INUSE        1    /* flags mask                */
  144. #define PUBLIC        2    /* flags mask                */
  145. #define CPMDIR        4    /* flags mask                */
  146. #define PERMROOM    8    /* flags mask                */
  147. #define SKIP        16    /* (temporary) flags mask for roomTab    */
  148. struct {
  149.     char     rtgen;        /* generation # of room         */
  150.     char     rtflags;        /* public/private flag etc        */
  151.     char     rtname[NAMESIZE];    /* name of room             */
  152.     unsigned rtlastMessage;    /* # of most recent message in room    */
  153. } roomTab[MAXROOMS];
  154.  
  155. struct {
  156.     char     rbgen;        /* generation # of room         */
  157.     char     rbflags;        /* same bits as flags above        */
  158.     char     rbname[NAMESIZE];    /* name of room             */
  159.     char     rbdisk;        /* disk this rooms files are in 0=>none */
  160.     char     rbuser;        /* user area for this rooms files    */
  161.     struct {
  162.     unsigned rbmsgNo;    /* every message gets unique#        */
  163.     int     rbmsgLoc;    /* sector message starts in        */
  164.     } msg[MSGSPERRM];
  165. #ifdef TEST
  166.     char rbOverRun[256];
  167. #else
  168.     char rbOverRun[2];        /* actually unneeded just now -- roomBuf*/
  169. #endif
  170.                 /* is exactly 256 at present        */
  171. } roomBuf;            /* buffer current room is held in    */
  172.  
  173. char thisRoom;            /* room currently in roomBuf    */
  174.  
  175. /*                  userlog stuff                */
  176. #define CRYPTADD      117    /*                    */
  177.  
  178. #define UCMASK        1    /* bit uppercase flag is in        */
  179. #define LFMASK        2    /* bitmask for linefeed flag        */
  180. #define EXPERT        4    /* bitmask for expert-user flag     */
  181. #define TABMASK     8    /* bitmask for tab flag         */
  182. #define AIDE           16    /* bitmask for aide flag        */
  183.  
  184. #define MAILSLOTS      58    /* twiddle to fit logBuf in 384 bytes    */
  185.  
  186. #define GENSHIFT    3    /* lbgen >> GENSHIFT gives generation    */
  187. #define CALLMASK    7    /* lbgen &  CALLMASK gives last visit    */
  188. #define MAXVISIT    8    /* #visits we remember old newestLo for */
  189. #define MAXGEN           32    /* six bits of generation => 64 of them */
  190. #define FORGET_OFFSET  (MAXGEN / 2)    /* For forgetting rooms     */
  191.  
  192. /* logbuf must be 384 bytes or less... including lbOverFlow, 384 or MORE*/
  193. struct logBuffer {
  194.     char      lbnulls;        /* #nulls, lCase, lFeeds        */
  195.     char      lbflags;        /* UCMASK, LFMASK, EXPERT, TABMASK, AIDE*/
  196.     char      lbwidth;        /* terminal width            */
  197.     char      lbname[NAMESIZE]; /* caller's name            */
  198.     char      lbpw[NAMESIZE];    /* caller's password            */
  199.     char      lbgen[MAXROOMS];    /* 6 bits gen, two bits lastvisit    */
  200.     int       lbvisit[MAXVISIT];/* newestLo for this and 3 prev. visits */
  201.     int       lbslot[MAILSLOTS];/* for private mail            */
  202.     unsigned  lbId[MAILSLOTS];    /* for private mail            */
  203. #ifdef TEST
  204.     char      lbOverFlow[256];
  205. #else
  206.     char      lbOverFlow[84];
  207. #endif
  208. } logBuf;
  209.  
  210. int thisLog;            /* entry currently in logBuf        */
  211. int thisSlot;            /* logTab slot logBuf was found via    */
  212.  
  213. int logfl;            /* log file fd                */
  214.  
  215. struct {
  216.     int  ltpwhash;        /* hash of password            */
  217.     int  ltnmhash;        /* hash of name             */
  218.     int  ltlogSlot;        /* location in userlog.buf        */
  219.     int  ltnewest;        /* last message on last call        */
  220. } logTab[MAXLOGTAB];
  221. int sizeLTentry;        /* contains size of a l